From: Aaron Schulz Date: Thu, 9 Jul 2015 22:59:48 +0000 (-0700) Subject: Fixed BadMethodCallException in FileRepo for bad titles X-Git-Tag: 1.31.0-rc.0~10821^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=5cbf1958d7db0169f075dda2009b549c177697e3;p=lhc%2Fweb%2Fwiklou.git Fixed BadMethodCallException in FileRepo for bad titles * Fixes regression from 7508b86ad3 Change-Id: I60c106b5b27db067b1884af95f5fb74a0a682a9a --- diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index e66fdafb40..5bac289da9 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -431,7 +431,9 @@ class FileRepo { # Now try an old version of the file if ( $time !== false ) { $img = $this->newFile( $title, $time ); - $img->load( $flags ); + if ( $img ) { + $img->load( $flags ); + } if ( $img && $img->exists() ) { if ( !$img->isDeleted( File::DELETED_FILE ) ) { return $img; // always OK @@ -452,10 +454,10 @@ class FileRepo { $redir = $this->checkRedirect( $title ); if ( $redir && $title->getNamespace() == NS_FILE ) { $img = $this->newFile( $redir ); - $img->load( $flags ); if ( !$img ) { return false; } + $img->load( $flags ); if ( $img->exists() ) { $img->redirectedFrom( $title->getDBkey() );